package com.im.business.api.controller;

import com.im.business.history.domain.MessageHistoryVO;
import com.im.business.api.feign.HistoryMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Created leijun
 * @Date 2021/10/30 8:33 上午
 */
@RestController("api/history")
public class HistoryMessageController {

    @Autowired
    private HistoryMessageService historyMessageService;

    /**
     * 分页查询历史单聊消息
     * @param senderId
     * @param receiverId
     * @param maxOffset
     */
    @RequestMapping("singleMessage")
    public List<MessageHistoryVO> selectHistorySingleMessage(Long senderId, Long receiverId, Long maxOffset) {
        return historyMessageService.selectSingleHistoryMessage(senderId, receiverId, maxOffset);
    }

    /**
     * 分页查询历史群里消息
     * @param groupId
     * @param maxOffset
     * @return
     */
    @RequestMapping("groupMessage")
    public List<MessageHistoryVO> selectHistoryGroupMessage(Long groupId, Long maxOffset) {
        return historyMessageService.selectGroupHistoryMessage(groupId, maxOffset);
    }
}
